package com.example.mydemo.entity.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.example.mydemo.entity.Menu;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;

/**
 * <p>
 * 
 * </p>
 *
 * @author syf
 * @since 2025-05-28
 */
@Getter
@Setter
@ToString
@TableName("sys_menu")
public class MenuVO implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 菜单编号
     */
    @TableId(value = "menu_id", type = IdType.AUTO)
    private Long menuId;

    /**
     * 菜单名称
     */
    private String title;

    /**
     * 菜单寻址：如xxx.html
     */
    private String href;

    /**
     * 菜单图标
     */
    private String icon;

    private String target ="_self";

    /**
     * 父类菜单id
     */
    private Long parentId;

    /**
     * 菜单类：一级二级三级
     */
    private Integer menuType;

    private Integer sort;

    private List<MenuVO> child;
    /**
     * 删除状态
     */
    private Long isDelete;

    /**
     * 禁用状态
     */
    private Byte isDisabled;

    /**
     * 创建人
     */


    /**
     * 创建时间
     */


    /**
     * 更新人
     */


    /**
     * 更新时间
     */
    private LocalDateTime updateTime;

    public static MenuVO convertToVO(Menu menu) {
        MenuVO vo = new MenuVO();
        vo.setMenuId(menu.getMenuId());
        vo.setParentId(menu.getParentId());
        vo.setSort(menu.getSort());
        vo.setHref(menu.getHref());
        vo.setIcon(menu.getIcon());
        vo.setIsDelete(menu.getIsDelete());
        vo.setTitle(menu.getTitle());
        vo.setIsDisabled(menu.getIsDisabled());
        return vo;
    }
}
